import request from '@/utils/request'
import {SERVER_URL} from '@/utils/common'
/**
 * 加载系统左侧菜单
 * @param params
 */
export function getSysMenuList(params) {
  return request({
    url: SERVER_URL.SYSTEM_SERVER+'/menu/getMenuByUserName',
    method: 'post',
    data:params
  })
}

export function  getMenuListPage(params) {
  return request({
    url: SERVER_URL.SYSTEM_SERVER+'/menu/getMenuListPage',
    method: 'post',
    data:params
  })
}


export function getMenuById(params) {
  return request({
    url: SERVER_URL.SYSTEM_SERVER+`/menu/getMenuById?id=${params}`,
    method: 'get'
  })
};


export function getMenusTreeByRoleId(id) {
  return request({
    url: SERVER_URL.SYSTEM_SERVER+`/menu/getMenusTreeByRoleId?roleId=${id}`,
    method: 'get'
  })
};


export function disabledOrEnabled(params) {
  return request({
    url: SERVER_URL.SYSTEM_SERVER+`/menu/disabledOrEnabled`,
    method: 'get',
    params: params
  })
}



export function saveOrUpdate(params){
  return request({
    url: params.id ? SERVER_URL.SYSTEM_SERVER+`/menu/update`: SERVER_URL.SYSTEM_SERVER+`/menu/save`,
    method: 'post',
    data:params
  })
};
